<?php

// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\api\logic;
use app\api\error\CodeBase;
use app\common\logic\LogicBase;

/**
 * 接口入口
 */
class Apido extends ApiBase {

    public function jump() {
        header("Content-type: text/html; charset=utf-8");
        if (IS_POST) {
            $method = $_POST['method'];

            $data = explode('|', $method);

            $contronller = $data[0];

            $to_method = $data[1];

            if (empty($to_method)) {
                $sc = $this;
                $to_method = $method;
            } else {
                $sc = controller($contronller);
            }
            if (method_exists($sc, $to_method)) {
                $sc->$to_method();
            } else {
               $this->apiError(CodeBase::$apiUrlError);
            }
        }
    }

}
